﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework;

namespace GameLibrary.Levels
{
    public class Levels
    {
        public List<int[]> map = new List<int[]>();
        
        List<Block> Blocks = new List<Block>();

        public void Load(Texture2D texture)
        {
            int i = 0;
            int j = 0;
            foreach (int[] blocks in map)
            {
                foreach (int block in blocks)
                {
                    if (block == 1)
                    {
                        Blocks.Add(new Block(texture, new Rectangle(i * 64, j * 64, 64, 64)));
                    }
                    i++;
                }
                j++;
                i = 0;
            }
        }
        public void Draw(SpriteBatch spriteBatch)
        {
            foreach(Block block in Blocks)
            {
                spriteBatch.Draw(block.texture, block.position, Color.White);
                    
            }
        }
 
    }
}
